home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / dev / src / expat-src.lha / expat-1.95.2 / doc / xmlwf.sgml < prev   
Encoding:
SGML Document  |  2001-12-03  |  11.8 KB  |  430 lines

  1. <!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
  2.  
  3. <!-- Process this file with docbook-to-man to generate an nroff manual
  4.      page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
  5.      the manual page with: `docbook-to-man manpage.sgml | nroff -man |
  6.      less'.  A typical entry in a Makefile or Makefile.am is:
  7.  
  8. manpage.1: manpage.sgml
  9.     docbook-to-man $< > $@
  10.   -->
  11.  
  12.   <!-- Fill in your name for FIRSTNAME and SURNAME. -->
  13.   <!ENTITY dhfirstname "<firstname>Scott</firstname>">
  14.   <!ENTITY dhsurname   "<surname>Bronson</surname>">
  15.   <!-- Please adjust the date whenever revising the manpage. -->
  16.   <!ENTITY dhdate      "<date>December  1, 2001</date>">
  17.   <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
  18.        allowed: see man(7), man(1). -->
  19.   <!ENTITY dhsection   "<manvolnum>1</manvolnum>">
  20.   <!ENTITY dhemail     "<email>bronson@rinspin.com</email>">
  21.   <!ENTITY dhusername  "Scott Bronson">
  22.   <!ENTITY dhucpackage "<refentrytitle>XMLWF</refentrytitle>">
  23.   <!ENTITY dhpackage   "xmlwf">
  24.  
  25.   <!ENTITY debian      "<productname>Debian GNU/Linux</productname>">
  26.   <!ENTITY gnu         "<acronym>GNU</acronym>">
  27. ]>
  28.  
  29. <refentry>
  30.   <refentryinfo>
  31.     <address>
  32.       &dhemail;
  33.     </address>
  34.     <author>
  35.       &dhfirstname;
  36.       &dhsurname;
  37.     </author>
  38.     <copyright>
  39.       <year>2001</year>
  40.       <holder>&dhusername;</holder>
  41.     </copyright>
  42.     &dhdate;
  43.   </refentryinfo>
  44.   <refmeta>
  45.     &dhucpackage;
  46.  
  47.     &dhsection;
  48.   </refmeta>
  49.   <refnamediv>
  50.     <refname>&dhpackage;</refname>
  51.  
  52.     <refpurpose>Determines if an XML document is well-formed</refpurpose>
  53.   </refnamediv>
  54.   <refsynopsisdiv>
  55.     <cmdsynopsis>
  56.       <command>&dhpackage;</command>
  57.       <arg><option>-s</option></arg>
  58.       <arg><option>-n</option></arg>
  59.       <arg><option>-p</option></arg>
  60.       <arg><option>-x</option></arg>
  61.  
  62.       <arg><option>-e <replaceable>encoding</replaceable></option></arg>
  63.       <arg><option>-w</option></arg>
  64.  
  65.       <arg><option>-d <replaceable>output-dir</replaceable></option></arg>
  66.       <arg><option>-c</option></arg>
  67.       <arg><option>-m</option></arg>
  68.  
  69.       <arg><option>-r</option></arg>
  70.       <arg><option>-t</option></arg>
  71.  
  72.       <arg>file ...</arg>
  73.     </cmdsynopsis>
  74.   </refsynopsisdiv>
  75.  
  76.   <refsect1>
  77.     <title>DESCRIPTION</title>
  78.  
  79.     <para>
  80.     <command>&dhpackage;</command> uses the Expat library to determine
  81.     if an XML document is well-formed.  It is non-validating.
  82.     </para>
  83.  
  84.     <para>
  85.     If you do not specify any files on the command-line,
  86.     and you have a recent version of &dhpackage;, the input
  87.     file will be read from stdin.
  88.     </para>
  89.  
  90.   </refsect1>
  91.  
  92.   <refsect1>
  93.     <title>WELL-FORMED DOCUMENTS</title>
  94.  
  95.     <para>
  96.       A well-formed document must adhere to the
  97.       following rules:
  98.     </para>
  99.  
  100.     <itemizedlist>
  101.       <listitem><para>
  102.         The file begins with an XML declaration.  For instance,
  103.         <literal><?xml version="1.0" standalone="yes"?></literal>.
  104.         <emphasis>NOTE:</emphasis> &dhpackage; does not currently
  105.         check for a valid XML declaration.
  106.       </para></listitem>
  107.       <listitem><para>
  108.         Every start tag is either empty (<tag/>)
  109.         or has a corresponding end tag.
  110.       </para></listitem>
  111.       <listitem><para>
  112.         There is exactly one root element.  This element must contain
  113.         all other elements in the document.  Only comments, white
  114.         space, and processing instructions may come after the close
  115.         of the root element.
  116.       </para></listitem>
  117.       <listitem><para>
  118.         All elements nest properly.
  119.       </para></listitem>
  120.       <listitem><para>
  121.         All attribute values are enclosed in quotes (either single
  122.         or double).
  123.       </para></listitem>
  124.     </itemizedlist>
  125.  
  126.     <para>
  127.       If the document has a DTD, and it strictly complies with that
  128.       DTD, then the document is also considered <emphasis>valid</emphasis>.
  129.       &dhpackage; is a non-validating parser -- it does not check the DTD.
  130.       However, it does support external entities (see the -x option).
  131.     </para>
  132.   </refsect1>
  133.  
  134.   <refsect1>
  135.     <title>OPTIONS</title>
  136.  
  137. <para>
  138. When an option includes an argument, you may specify the argument either
  139. separate ("d output") or mashed ("-doutput").  &dhpackage; supports both.
  140. </para>
  141.  
  142.     <variablelist>
  143.  
  144.       <varlistentry>
  145.         <term><option>-c</option></term>
  146.         <listitem>
  147.         <para>
  148.   If the input file is well-formed and &dhpackage; doesn't
  149.   encounter any errors, the input file is simply copied to
  150.   the output directory unchanged.
  151.   This implies no namespaces (turns off -n) and
  152.   requires -d to specify an output file.
  153.           </para>
  154.         </listitem>
  155.       </varlistentry>
  156.  
  157.       <varlistentry>
  158.         <term><option>-d output-dir</option></term>
  159.         <listitem>
  160.         <para>
  161.   Specifies a directory to contain transformed
  162.   representations of the input files.
  163.   By default, -d outputs a canonical representation
  164.   (described below).
  165.   You can select different output formats using -c and -m.
  166.       </para>
  167.       <para>
  168.   The output filenames will
  169.   be exactly the same as the input filenames or "STDIN" if the input is
  170.   coming from STDIN.  Therefore, you must be careful that the
  171.   output file does not go into the same directory as the input
  172.   file.  Otherwise, &dhpackage; will delete the input file before
  173.   it generates the output file (just like running
  174.   <literal>cat < file > file</literal> in most shells).
  175.       </para>
  176.       <para> 
  177.   Two structurally equivalent XML documents have a byte-for-byte
  178.   identical canonical XML representation.
  179.   Note that ignorable white space is considered significant and
  180.   is treated equivalently to data.
  181.   More on canonical XML can be found at
  182.   http://www.jclark.com/xml/canonxml.html .
  183.       </para>
  184.         </listitem>
  185.       </varlistentry>
  186.  
  187.       <varlistentry>
  188.         <term><option>-e encoding</option></term>
  189.         <listitem>
  190.         <para>
  191.    Specifies the character encoding for the document, overriding
  192.    any document encoding declaration.  &dhpackage;
  193.    has four built-in encodings: 
  194.        <literal>US-ASCII</literal>,
  195.     <literal>UTF-8</literal>,
  196.     <literal>UTF-16</literal>, and
  197.     <literal>ISO-8859-1</literal>.
  198.     Also see the -w option.
  199.        </para>
  200.         </listitem>
  201.       </varlistentry>
  202.  
  203.       <varlistentry>
  204.         <term><option>-m</option></term>
  205.         <listitem>
  206.         <para>
  207.   Outputs some strange sort of XML file that completely
  208.   describes the the input file, including character postitions.
  209.   Requires -d to specify an output file.
  210.        </para>
  211.         </listitem>
  212.       </varlistentry>
  213.  
  214.       <varlistentry>
  215.         <term><option>-n</option></term>
  216.         <listitem>
  217.         <para>
  218.   Turns on namespace processing.  (describe namespaces)
  219.   -c disables namespaces.
  220.        </para>
  221.         </listitem>
  222.       </varlistentry>
  223.  
  224.       <varlistentry>
  225.         <term><option>-p</option></term>
  226.         <listitem>
  227.         <para>
  228.     Tells xmlwf to process external DTDs and parameter
  229.     entities.
  230.      </para>
  231.      <para>
  232.     Normally &dhpackage; never parses parameter entities.
  233.     -p tells it to always parse them.
  234.     -p implies -x.
  235.        </para>
  236.         </listitem>
  237.       </varlistentry>
  238.  
  239.       <varlistentry>
  240.         <term><option>-r</option></term>
  241.         <listitem>
  242.         <para>
  243.    Normally &dhpackage; memory-maps the XML file before parsing.
  244.    -r turns off memory-mapping and uses normal file IO calls instead.
  245.    Of course, memory-mapping is automatically turned off
  246.    when reading from STDIN.
  247.        </para>
  248.         </listitem>
  249.       </varlistentry>
  250.  
  251.       <varlistentry>
  252.         <term><option>-s</option></term>
  253.         <listitem>
  254.         <para>
  255.   Prints an error if the document is not standalone. 
  256.   A document is standalone if it has no external subset and no
  257.   references to parameter entities.
  258.        </para>
  259.         </listitem>
  260.       </varlistentry>
  261.  
  262.       <varlistentry>
  263.         <term><option>-t</option></term>
  264.         <listitem>
  265.         <para>
  266.   Turns on timings.  This tells Expat to parse the entire file,
  267.   but not perform any processing.
  268.   This gives a fairly accurate idea of the raw speed of Expat itself
  269.   without client overhead.
  270.    -t turns off most of the output options (-d, -m -c, ...)
  271.        </para>
  272.         </listitem>
  273.       </varlistentry>
  274.  
  275.       <varlistentry>
  276.         <term><option>-w</option></term>
  277.         <listitem>
  278.         <para>
  279.   Enables Windows code pages.
  280.   Normally, &dhpackage; will throw an error if it runs across
  281.   an encoding that it is not equipped to handle itself.  With
  282.   -w, &dhpackage; will try to use a Windows code page.  See
  283.   also -e.
  284.        </para>
  285.         </listitem>
  286.       </varlistentry>
  287.  
  288.       <varlistentry>
  289.         <term><option>-x</option></term>
  290.         <listitem>
  291.         <para>
  292.   Turns on parsing external entities.
  293.   </para>
  294. <para>
  295.   Non-validating parsers are not required to resolve external
  296.   entities, or even expand entities at all.
  297.   Expat always expands internal entities (?),
  298.   but external entity parsing must be enabled explicitly.
  299.   </para>
  300.   <para>
  301.   External entities are simply entities that obtain their
  302.   data from outside the XML file currently being parsed.
  303.   </para>
  304.   <para>
  305.   This is an example of an internal entity:
  306. <literallayout>
  307. <!ENTITY vers '1.0.2'>
  308. </literallayout>
  309.   </para>
  310.   <para>
  311.   And here are some examples of external entities:
  312.  
  313. <literallayout>
  314. <!ENTITY header SYSTEM "header-&vers;.xml">  (parsed)
  315. <!ENTITY logo SYSTEM "logo.png" PNG>         (unparsed)
  316. </literallayout>
  317.  
  318.        </para>
  319.         </listitem>
  320.       </varlistentry>
  321.  
  322.       <varlistentry>
  323.         <term><option>--</option></term>
  324.         <listitem>
  325.         <para>
  326.     For some reason, &dhpackage; specifically ignores "--"
  327.     anywhere it appears on the command line.
  328.        </para>
  329.         </listitem>
  330.       </varlistentry>
  331.     </variablelist>
  332.  
  333.     <para>
  334.     Older versions of &dhpackage; do not support reading from STDIN.
  335.     </para>
  336.   </refsect1>
  337.  
  338.   <refsect1>
  339.   <title>OUTPUT</title>
  340.     <para>
  341.     If an input file is not well-formed, &dhpackage; outputs
  342.     a single line describing the problem to STDOUT.
  343.     If a file is well formed, &dhpackage; outputs nothing.
  344.     Note that the result code is <emphasis>not</emphasis> set.
  345.     </para>
  346.   </refsect1>
  347.   
  348.   <refsect1>
  349.     <title>BUGS</title>
  350.     <para>
  351.     According to the W3C standard, an XML file without a
  352.     declaration at the beginning is not considered well-formed.
  353.     However, &dhpackage; allows this to pass.
  354.     </para>
  355.     <para>
  356.     &dhpackage; returns a 0 - noerr result, even if the file is
  357.     not well-formed.  There is no good way for a program to use
  358.     xmlwf to quickly check a file -- it must parse xmlwf's STDOUT.
  359.     </para>
  360.     <para>
  361.     The errors should go to STDERR, not stdout.
  362.     </para>
  363.     <para>
  364.     There should be a way to get -d to send its output to STDOUT
  365.     rather than forcing the user to send it to a file.
  366.     </para>
  367.     <para>
  368.     I have no idea why anyone would want to use the -d, -c
  369.     and -m options.  If someone could explain it to me, I'd
  370.     like to add this information to this manpage.
  371.     </para>
  372.   </refsect1>
  373.  
  374.   <refsect1>
  375.     <title>ALTERNATIVES</title>
  376.     <para>
  377.       Here are some XML validators on the web:
  378.  
  379. <literallayout>
  380. http://www.hcrc.ed.ac.uk/~richard/xml-check.html
  381. http://www.stg.brown.edu/service/xmlvalid/
  382. http://www.scripting.com/frontier5/xml/code/xmlValidator.html
  383. http://www.xml.com/pub/a/tools/ruwf/check.html
  384.      (on a page with no less than 15 ads!  Shame!)
  385. </literallayout>
  386.  
  387.          </para>
  388.   </refsect1>
  389.  
  390.   <refsect1>
  391.     <title>SEE ALSO</title>
  392.     <para>
  393.  
  394. <literallayout>
  395. The Expat home page:        http://expat.sourceforge.net/
  396. The W3 XML specification:   http://www.w3.org/TR/REC-xml
  397. </literallayout>
  398.  
  399.     </para>
  400.   </refsect1>
  401.  
  402.   <refsect1>
  403.     <title>AUTHOR</title>
  404.     <para>
  405.       This manual page was written by &dhusername; &dhemail; for
  406.       the &debian; system (but may be used by others).  Permission is
  407.       granted to copy, distribute and/or modify this document under
  408.       the terms of the <acronym>GNU</acronym> Free Documentation
  409.       License, Version 1.1.
  410.     </para>
  411.   </refsect1>
  412. </refentry>
  413.  
  414. <!-- Keep this comment at the end of the file
  415. Local variables:
  416. mode: sgml
  417. sgml-omittag:t
  418. sgml-shorttag:t
  419. sgml-minimize-attributes:nil
  420. sgml-always-quote-attributes:t
  421. sgml-indent-step:2
  422. sgml-indent-data:t
  423. sgml-parent-document:nil
  424. sgml-default-dtd-file:nil
  425. sgml-exposed-tags:nil
  426. sgml-local-catalogs:nil
  427. sgml-local-ecat-files:nil
  428. End:
  429. -->
  430.